<?
////设置默认的搜索数据，就是昨天的统计
//
//if(!$_REQUEST['starttime']){$_REQUEST['starttime']=date("Y-m-d",strtotime("-1 day"));}
//if(!$_REQUEST['endtime']){$_REQUEST['endtime']=date("Y-m-d H:i:s");}
//
//
//if(!$_REQUEST['departmentid']){
//    $_REQUEST['departmentid']=$_SESSION['departmentid'];
//}
//
//
//$departmentid=$_REQUEST['departmentid'];
//
//
//
// if(($departmentid=="全选")||($departmentid==""))
//{
//    $departmentstr="";
//    $department['name']="全部";
//}
//else{
//    $departmentstr="departmentid = '$departmentid' and";
//}
//;
//
//
//
//$departmentid=$_REQUEST['departmentid'];
//
//$starttime=$_REQUEST['starttime'];
//$endtime=$_REQUEST['endtime'];
//
//$starttime=$_REQUEST['starttime']." 00:00:00";
//$endtime=$_REQUEST['endtime']." 23:59:59";
?>









<!---->
<!--<div class="select-function">-->
<!--    <form action="" method="post">-->
<!---->
<!--        <button class="layui-btn member-info-btn">查询</button>-->
<!---->
<!--        <div class="layui-form-item">-->
<!--            <label class="layui-form-label">部门-->
<!--            </label>-->
<!--            <div class="layui-input-block">-->
<!--                <select name="departmentid" lay-search="">-->
<!---->
<!--                    <option value="" >请选择</option>-->
<!--                    <option value="全选" >全选</option>-->
<!--                    --><?// for($i=0;$i<count($department_list);$i++){ ?>
<!--                        <option value="--><?// echo $department_list[$i]['nid'] ?><!--">--><?// echo $department_list[$i]['nid'] ?><!-- : --><?// echo $department_list[$i]['name'] ?><!--</option>-->
<!--                    --><?// } ?>
<!--                </select>-->
<!--            </div>-->
<!--        </div>-->
<!---->
<!---->
<!--        <div class="layui-form-item" >-->
<!--            <label class="layui-form-label">时间段</label>-->
<!--            <div class="layui-input-block">-->
<!--                <input type="text" name="starttime" id="date" autocomplete="off" class="layui-input"  value="--><?// echo date("Y-m-d",strtotime("-1 day"))?><!--" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" class="laydate-icon">-->
<!--            </div>-->
<!---->
<!--        </div>-->
<!---->
<!---->
<!---->
<!--        <div class="layui-form-item" >-->
<!--            <label class="layui-form-label" style=" width:10px">-</label>-->
<!--            <div class="layui-input-block" style="margin-left:45px; margin-right: 45px;">-->
<!--                <input type="text" name="endtime" id="date" autocomplete="off" class="layui-input "  value="--><?// echo date("Y-m-d") ?><!--" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" class="">-->
<!--            </div>-->
<!--        </div>-->
<!---->
<!---->
<!---->
<!---->
<!--        <br class="clearfloat"/>-->
<!---->
<!--</div>-->

<div class="detail-box statistics-box layui-form">



    <div class="layui-form">
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col>
                <col>
                <col>
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>部门</th>
                <th>招生人数</th>
                <th>已付款人数</th>
                <th>未付款人数</th>
                <th>已收学费</th>
                <th>未收学费</th>
                <th>未开收据</th>
                <th>未递交体检表</th>
            </tr>
            </thead>
            <tbody>



           <? $department_list=select_lines_all_items($table_Prefix."department","nid desc","tag = '是'","0");

           ?>

<?for($i=0;$i<count($department_list);$i++){?>
            <tr>

                <td><? echo $department_list[$i]['name'];?></td>
                <td><? echo count_by_item($table_Prefix."member","departmentid = '".$department_list[$i]['nid']."'");?></td>

                <td><? echo count_by_item($table_Prefix."member","status = '已收款' and departmentid = '".$department_list[$i]['nid']."'");?></td>

                <td><? echo count_by_item($table_Prefix."member","status = '未收款' and departmentid = '".$department_list[$i]['nid']."'");?></td>

                <td><? echo sum_total($table_Prefix."member","cost","status = '已收款' and departmentid = '".$department_list[$i]['nid']."'");?></td>
                <td><? echo sum_total($table_Prefix."member","cost","status = '未收款' and departmentid = '".$department_list[$i]['nid']."'");?></td>

                <td> <? echo count_by_item($table_Prefix."member","departmentid = '".$department_list[$i]['nid']."' and receipt != '已生成' ");?></td>

                <td><? echo count_by_item($table_Prefix."member","departmentid = '".$department_list[$i]['nid']."' and healthform != '已提交' ");?></td>

            </tr>
<?;}?>

            </tbody>
        </table>
    </div>




    <h2>最近七日招生统计</h2>
    <div class="layui-form">
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col>
                <col>
                <col>
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>部门</th>
                <? for($i=0;$i<7;$i++){?>
                    <td><?echo date("Y-m-d",strtotime("-$i day"))?></td>
                <?}?>
            </tr>
            </thead>
            <tbody>


            <?for($i=0;$i<count($department_list);$i++){?>

                <tr>
                    <td><? echo $department_list[$i]['name'];?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m-d",strtotime("-0 day"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m-d",strtotime("-1 day"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m-d",strtotime("-2 day"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m-d",strtotime("-3 day"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m-d",strtotime("-4 day"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m-d",strtotime("-5 day"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m-d",strtotime("-6 day"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
<!--                    <td>--><?// echo sum_total($table_Prefix."member","cost",$departmentstr."date like '".date("Y-m-d",strtotime("-$i day"))."%' status = '已收款' and departmentid = '$departmentid'");?><!--</td>-->
                </tr>

            <?}?>



            </tbody>
        </table>
    </div>




    <h2>最近12月统计</h2>
    <div class="layui-form">
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col>
                <col>
                <col>
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>部门</th>
                <? for($i=0;$i<12;$i++){?>
            <th>
                 <?echo date("Y-m",strtotime("-$i month"))?>
            </th> <?}?>
            </thead>
            <tbody>

            <?for($i=0;$i<count($department_list);$i++){?>

                <tr>
                    <td><? echo $department_list[$i]['name'];?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-0 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-1 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-2 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-3 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-4 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-5 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-6 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-7 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-8 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-9 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-10 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>
                    <td><? echo count_by_item($table_Prefix."member","date like '".date("Y-m",strtotime("-11 month"))."%'  and departmentid = '".$department_list[$i]['nid']."'");?></td>

                </tr>

            <?}?>





            </tbody>
        </table>
    </div>








</div>